Linear model conditional on random effects \(b\): \[
(y \,|\,b)
\mathrel{\sim}\mathcal{N} \left( X \beta + Z b, \sigma^2 I_n \right)
\] \(X\) is an \(n \times p\) design matrix.
Distribution of \(b\): \[
b \mathrel{\sim}\mathcal{N} (0, \Sigma)
\] \(Z\) is an \(n \times q\) design matrix, \(\Sigma\) is positive definite.
More precisely, there can be several random effects terms \(i\), \(Z_i b_i\), and for each \(Z_i\) contains a \(q_i\) regressors within \(r_i\) groups. The coefficients for the regressors within each group have a \(q_i × q_i\)
covariance \(\Sigma_i\) across groups. I.e. \[
b_i \mathrel{\sim}\mathcal{N} (0, I_{r_i} ⊗ \Sigma_i)
\]
The example data
Load sleepstudy and restrict to 3 days and 3 subjects:
Model, variables are (Intercept) and Days, both fixed and random:
model <-lmer(Reaction ~ Days + (Days | Subject), data)summary(model)
Linear mixed model fit by REML ['lmerMod']
Formula: Reaction ~ Days + (Days | Subject)
Data: data
REML criterion at convergence: 65.6
Scaled residuals:
Min 1Q Median 3Q Max
-1.3294 -0.3361 -0.0463 0.5375 0.9859
Random effects:
Groups Name Variance Std.Dev. Corr
Subject (Intercept) 808.5 28.43
Days 122.8 11.08 -0.56
Residual 140.0 11.83
Number of obs: 9, groups: Subject, 3
Fixed effects:
Estimate Std. Error t value
(Intercept) 221.403 17.561 12.607
Days 2.792 8.016 0.348
Correlation of Fixed Effects:
(Intr)
Days -0.585
We now try to extract the parts of the model in the equation above (constants and estimates).